package cn.fansunion.concurrent.threadabc.notify;

public class ThreadB extends Thread {
	private Object lock;

	public ThreadB(Object lock) {
		super();
		this.lock = lock;
	}

	@Override
	public void run() {
		try {
			synchronized (lock) {
				for (int i = 0; i < 10; i++) {
					lock.notify();
					System.out.println("已经发出了通知");
					System.out.println("添加了" + (i + 1) + "个元素!");
					//Thread.sleep(1000);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
